package com.lkm.app_ui.ui.sale;

import com.lkm.app_ui.m.fun.DelegatePayTask;
import com.lkm.app_ui.m.fun.OnKeyNumberEvent;
import com.lkm.javatool.lang.RunnablePR;
import com.lkm.market2_0.m.steelyarddata.OrderEntity;
import com.lkm.market2_0.m.steelyardserver.OnSteelyardKeyEvent;
import com.lkm.mvp.BasePresenter;
import com.lkm.mvp.BaseView;

import java.util.List;



public class SaleContract {

    public static SaleContract.Presenter presenter;

    public static SaleContract.SubtotalPresenter subtotalPresenter;

    public static class PrintInfo{
        public PrintInfo(String print, String qrCode) {
            this.print = print;
            this.qrCode = qrCode;
        }

        public String print;
        public String qrCode;
    }



    public interface GoodImageView {

        void setPresenter(GoodImagePresenter presenter);

        GoodImagePresenter getPresenter();



        void showTackGoodImage(String imgPath);



        void showTackGoodImageByAi(String imgPath);



        void showGoodImageDiscern(String goodName);

    }


    public interface GoodImagePresenter {

        void binView(GoodImageView baseView);



        void setOnTackGoodImage(RunnablePR<String,Void> pr);
    }

    public interface SubtotalView {

        void setPresenter(SubtotalPresenter presenter);

        SubtotalPresenter getPresenter();


        void upSubtotal(List<OrderEntity.GoodEntity> souceList);




        void editSubtotal(boolean isIn);


        void upSubtotalTotalPrice(String allTotalPrice);



        void confirmClearList(Runnable confirm);


        void showPay();



        void showTips(int tips);


    }

    public interface SubtotalPresenter extends SubtotalViewEvent{


        void binView(SaleContract.SubtotalView baseView);



        void upLastName(String name);


        boolean hasGoodEntity(long itemId);



        void clearAll();



        void inEditSubtotal();

        void exitEditSubtotal();


        void tryQuickPay();

        void tryFullPay(@DelegatePayTask.PayType int payType);
    }





    public interface View extends BaseView<SaleContract.Presenter> {


        void setPageTitle(String title);



        void upWeightChangeInfo(String name, String weight, String unitPrice, String totalPrice);





        void showTips(int tips);



        void showPaySuccess(PrintInfo printInfo);

        boolean isExit();
    }



    public interface Presenter extends BasePresenter<SaleContract.View> {

        PrintInfo createPrintInfo(OrderEntity orderEntity);
        void printOrder(PrintInfo printInfo);

    }













    interface SubtotalViewEvent {

        void onKeyNumberEvent(OnKeyNumberEvent data);

        void onSteelyardKeyEvent(OnSteelyardKeyEvent data);

    }

}
